/*
** check_port.c for zappy in /home/morgan_t/zappy-2015-2014s-suon_a/server
** 
** Made by thomas morgant
** Login   <morgan_t@epitech.net>
** 
** Started on  Mon Jun 18 17:45:00 2012 thomas morgant
** Last update Mon Jul  2 12:58:49 2012 thomas morgant
*/

#include "server.h"
#include "conf.h"
#include "check.h"

bool	check_port(t_serv *serv, int ac, char **av)
{
  int	port;

  (void) serv;
  (void) ac;
  port = 0;
  if ((strncmp(av[1], "-p", 2) != 0))
    {
      puts("Bad usage\n");
      printf(USAGE);
      return (false);
    }
  else
    {
      port = atoi(av[2]);
      if ((port > 1023) && (port <= 65535))
	port = port;
    }
  return (true);
}
